﻿using MOKA.TPM.Utility.Const;
using SqlSugar;
using System.ComponentModel.DataAnnotations;

namespace MOKA.TPM.Entity;

public class SysFile
{
    /// <summary>
    /// 主键Id
    /// </summary>
    [SugarColumn(ColumnName = "Id", ColumnDescription = "主键Id", IsPrimaryKey = true)]
    public long Id { get; set; }

    /// <summary>
    /// 提供者
    /// </summary>
    [SugarColumn(ColumnName = "Provider", ColumnDescription = "提供者", Length = 128)]
    [MaxLength(128)]
    public string? Provider { get; set; }

    /// <summary>
    /// 仓储名称
    /// </summary>
    [SugarColumn(ColumnName = "BucketName", ColumnDescription = "仓储名称", Length = 128)]
    [MaxLength(128)]
    public string? BucketName { get; set; }

    /// <summary>
    /// 文件名称
    /// </summary>
    [SugarColumn(ColumnName = "FileName", ColumnDescription = "文件名称", Length = 128)]
    [MaxLength(128)]
    public string? FileName { get; set; }

    /// <summary>
    /// 文件后缀
    /// </summary>
    [SugarColumn(ColumnName = "Suffix", ColumnDescription = "文件后缀", Length = 16)]
    [MaxLength(16)]
    public string? Suffix { get; set; }

    /// <summary>
    /// 存储路径
    /// </summary>
    [SugarColumn(ColumnName = "FilePath", ColumnDescription = "存储路径", Length = 512)]
    [MaxLength(512)]
    public string? FilePath { get; set; }

    /// <summary>
    /// 文件大小KB
    /// </summary>
    [SugarColumn(ColumnName = "SizeKb", ColumnDescription = "文件大小KB")]
    public long SizeKb { get; set; }

    /// <summary>
    /// 文件大小信息
    /// </summary>
    [SugarColumn(ColumnName = "SizeInfo", ColumnDescription = "文件大小信息", Length = 64)]
    [MaxLength(64)]
    public string? SizeInfo { get; set; }

    /// <summary>
    /// 外链地址
    /// </summary>
    [SugarColumn(ColumnName = "Url", ColumnDescription = "外链地址", Length = 512)]
    [MaxLength(512)]
    public string? Url { get; set; }

    /// <summary>
    /// 文件MD5
    /// </summary>
    [SugarColumn(ColumnName = "FileMd5", ColumnDescription = "文件MD5", Length = 128)]
    [MaxLength(128)]
    public string? FileMd5 { get; set; }

    /// <summary>
    /// 关联对象名称
    /// </summary>
    [SugarColumn(ColumnName = "RelationName", ColumnDescription = "关联对象名称", Length = 128)]
    [MaxLength(128)]
    public string? RelationName { get; set; }

    /// <summary>
    /// 关联对象Id
    /// </summary>
    [SugarColumn(ColumnName = "RelationId", ColumnDescription = "关联对象Id")]
    public long? RelationId { get; set; }

    /// <summary>
    /// 所属Id
    /// </summary>
    [SugarColumn(ColumnName = "BelongId", ColumnDescription = "所属Id")]
    public long? BelongId { get; set; }

    /// <summary>
    /// 文件类别
    /// </summary>
    [SugarColumn(ColumnName = "FileType", ColumnDescription = "文件类别", Length = 128)]
    [MaxLength(128)]
    public string? FileType { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>
    [SugarColumn(ColumnName = "CreateTime", ColumnDescription = "创建时间")]
    public DateTime? CreateTime { get; set; }

    /// <summary>
    /// 更新时间
    /// </summary>
    [SugarColumn(ColumnName = "UpdateTime", ColumnDescription = "更新时间")]
    public DateTime? UpdateTime { get; set; }

    /// <summary>
    /// 子表：点检设备
    /// </summary>
    [Navigate(NavigateType.OneToMany, nameof(Checkup.ImageId))]//一对多
    public List<Checkup> Checkups { get; set; }
}